<%@ page import="java.util.Date" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<!--修改流程人员弹窗  -->
<div  class="content-warp">
    <div class="distribPersonel" id="updateUserPageBox" style="padding: 20px 20px">
        <p >
           <strong>所需证书:</strong>  &nbsp;&nbsp;&nbsp;&nbsp;
            <span>${tr1d1}/${tr1d2}/${tr1d3}</span> &nbsp;&nbsp;
            <span><c:if test="${tr2d1}">不</c:if>需要社保/${tr2d2}</span>   &nbsp;&nbsp;&nbsp;&nbsp;
            <span><c:if test="${tr3d1}">不</c:if>需要人才原件配合/<c:if test="${tr3d2}">不</c:if>需要人才出场配合</span> &nbsp;&nbsp;&nbsp;
            <span>数量${tr4d1}本</span>
        </p>
        <br>
        <form action="" id="updateUserForm" >
            <div class="table-warp">
                <table  class="cell-border crm-table columnsHidden dataTable" id="orderTable">
                    <tr style="text-align: center; background-color: #e8e8e8" >
                        <th>序号</th>
                        <th>证书编号</th>
                        <th>持证人</th>
                        <th>类型/专业/等级</th>
                        <th>超期状态</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                    <c:forEach items="${generalCertificateList}" var="generalCertificate" varStatus="index">
                        <tr style="text-align: center">
                            <td>${index.index + 1}</td>
                            <td><a href="javascript:void(0);" class="layui-table-link" onclick="credentialDetail('${generalCertificate.certificateNo}','${generalCertificate.id}')">${generalCertificate.certificateNo}</a></td>
                            <td>${generalCertificate.personalName}/${generalCertificate.personalPhone}</td>
                            <td>${generalCertificate.certificateType}/${generalCertificate.certificateSpecialtys}/${generalCertificate.certificateLevel}</td>
<%--                            <td>${generalCertificate.affiliatedExpireTime}</td>--%>
                            <td>
                                <c:if test="${generalCertificate.specialNote=='0'}"><span  style="color: green">未超期</span></c:if>
                                <c:if test="${generalCertificate.specialNote=='1'}"><span  style="color: red">超期</span></c:if>
                            </td>
<%--                            <td>true?<span  style="color: green">未超期</span>:<span  style="color: red">超期</span></td>--%>
<%--                            <td>${new Date(generalCertificate.certificateEntryTime).getTime() - new Date().getTime())? "<span  style="color: green">未超期</span>":<span  style="color: red">超期</span>}</td>--%>
                            <td><fmt:formatDate value="${generalCertificate.certificateEntryTime}" pattern="yyyy-MM-dd HH:mm:ss" /></td>

                            <td>
                                <a href="JavaScript:void(0);" class="layui-btn layui-btn-orange" onclick="certificateMatching('${generalCertificate.id}','${generalCertificate.certificateNo}','${scOrderId}',1)">配证</a>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function time1(affiliatedExpireTime) {
        let t1 = new Date(affiliatedExpireTime).getTime();
        let t2 = new Date().getTime();
        if(t1>t2){
            return "<span  style=\'color:green\'>未超期</span>";
        }else{
            return "<span  style=\'color:red\'>超期</span>";
        }
    });

    /* 匹配证书 */
    function certificateMatching(certificateId,certificateNo,scOrderId,type) {
        DGG.Confire("确定匹配此证书吗？", '匹配证书', function () {
            $.ajax({
                type: 'POST',
                async: true,
                data: {
                    'certificateId': certificateId,
                    'certificateNo': certificateNo,
                    'scOrderId': scOrderId,
                    'type': type
                },
                url: sysInfo.basePath + '/zzsc/inprocess/save_certificate_advance_and_match_certificate.do',
                dataType: 'JSON',
                success: function (data) {
                    DGG.loading('close');
                    if (data.code == 0) {
                        DGG.Succeed('操作成功！')
                        setTimeout(function () {
                            layer.closeAll();
                        }, 1000);
                        window.location.reload();
                    } else {
                        DGG.Errors(data.msg);
                    }
                },
                error: function () {
                    DGG.Errors('保存失败，请联系管理员！！');
                }
            })
        })
    }

</script>





